package com.woniuxy.staff.service.impl;

import com.woniuxy.commons.entity.Dept;
import com.woniuxy.commons.entity.Role;
import com.woniuxy.commons.entity.Staff;
import com.woniuxy.staff.mapper.StaffMapper;
import com.woniuxy.staff.service.StaffService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author author
 * @create 2021-11-10 11:24
 */
@Service
public class StaffServiceImpl implements StaffService {

@Resource
private StaffMapper staffMapper;



    @Override
    public void addStaff(Staff staff) {
         staffMapper.addStaff(staff);
    }

    @Override
    public void updateStaff(Staff staff) {
         staffMapper.updateStaff(staff);
    }

    @Override
    public List<Staff> selectAllStaff(Staff staff, Integer pageIndex, Integer pageSize) {
        List<Staff> staff1 = staffMapper.selectAllStaff(staff, pageIndex, pageSize);
        return staff1;
    }

    @Override
    public int selectStaffCountBylimit(Staff staff) {
        int i = staffMapper.selectStaffCountBylimit(staff);
        return i;
    }

    @Override
    public void delectStaffByid(int sid) {
        staffMapper.delectStaffByid(sid);
    }

    @Override
    public List<Role> getallRole() {
        List<Role> roles = staffMapper.getallRole();
        return roles;
    }

    @Override
    public List<Dept> getallDept() {
        List<Dept> depts = staffMapper.getallDept();
        return depts;
    }

    @Override
    public Staff getStaffByName(String username) {
        return staffMapper.getStaffByName(username);
    }

    @Override
    public List<String> getPermissionByUsername(String username) {
        return staffMapper.getPermissionByUsername(username);
    }
}
